extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
#include "libswscale/swscale.h"
};

#include <string>
using namespace std;

class H264DecoderFrame
{
public:
	H264DecoderFrame();
	~H264DecoderFrame();

public:
	int init();
	int open(const string& p_objFileName);
	int deCoderAllFile();
	int deCoderOneFrame(char* p_szData, const int p_nDataLen, AVFrame*& p_pobjAVFrame);
	void close();

private:
	int saveYUV(AVFrame* p_pobjAVFrame, const string& p_strFilaName);

private:
	AVFormatContext*	m_pobjAVFormatContext;
	AVCodecContext*		m_pobjAVCodecCtx;
	AVCodec*			m_pobjAVCodec;
	AVFrame*			m_pobjAVFrame;
	uint8_t*			m_szFrameBuffer;
	AVPacket*			m_pobjAVPacket;
	struct SwsContext*	m_pobjImgConvertCtx;
	int					m_nVideoIndex;
};
